/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sheep.view.jung.utils;

import edu.uci.ics.jung.graph.ArchetypeVertex;
import edu.uci.ics.jung.graph.decorators.VertexStringer;
import java.util.Map;
import sheep.model.Task;
import sheep.model.graph.OurVertex;

/**
 *
 * @author geek
 */
/** Gestion des labels pour les Vertex **/
public class VertexLabel implements VertexStringer {


   
   private boolean afficherLabel = true;
   
   public VertexLabel() { 
   } 


  public boolean isAfficherLabel() {
     return afficherLabel;
  }

  public void setAfficherLabel(boolean afficherLabel) {
     this.afficherLabel = afficherLabel;
  }

  public String getLabel(ArchetypeVertex v) {
         if(afficherLabel && v.getUserDatum("Key")!=null){
            Task task =(Task)v.getUserDatum("Key");
            //String label = new String();
            
            if(task.getName().equals("start")){
              return "Nom: "+ task.getName()+
                      ";Debut : "+task.getActualBeginTime().getTime().toString().substring(0, 10);
            }
            if(task.getName().equals("end")){
              return "Nom: "+ task.getName() + 
                      ";Fin : "+task.getActualEndTime().getTime().toString().substring(0, 10);
            }
              return "Nom: "+ task.getName() + 
                      ";Duree: "+task.getDuration() +
//                      ";Debut : "+task.getActualBeginTime().getTime().toString().substring(0, 10) +
//                      ";Fin : "+task.getActualEndTime().getTime().toString().substring(0, 10) +
                      ";Debut au plus tot: "+task.getEarliestBeginTime().getTime().toString().substring(0, 10) +
                      ";Debut au plus tard: "+task.getLatestBeginTime().getTime().toString().substring(0, 10) +
                      
                      ";Fin au plus tot: "+task.getEarliestEndTime().getTime().toString().substring(0, 10) +
                      ";Fin au plus tard: "+task.getLatestEndTime().getTime().toString().substring(0, 10);// +
                      
                      //";Critique: "+task.isCritical() +
                      //";Detaillee: "+task.isDetailled();
           //}
         }else
            return "";
  }

}
